package controllers.security;

import play.mvc.Http;
import services.user.*;
import utils.MVCUtils;

/**
 * User: yeqingzhou
 * Date: 12-8-30
 */
public class SecuredAdmin extends Secured{
    @Override
    public String getUsername(Http.Context ctx) {
        try{
            String userEmail = MVCUtils.pullLocalUserKey(ctx);
            if(!AniLocalAdminService.isUserAdmin(userEmail)){
                return null;
            }
            return userEmail;
        }catch (Exception e){
            return null;
        }
    }
}
